import './assets/main.css'
import '@/assets/css/common.css'
import '@/assets/css/scss/common.css'
import 'element-plus/dist/index.css'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import * as common from '@/assets/js/common.js';
// import * as sockethandle from '@/assets/js/sockethandle.js';


router.beforeEach((to, from, next) => {
    // 如果在主页并且未登录，则跳转到登录页面
    const excludeRoutes = ['login', 'register']
    if(!excludeRoutes.includes(to.name) && !common.hasSessionStorageValues('userLoginInfo')){
        next('/login'); // 跳转到登录页或其他处理方式
    }else{
        next();
    }
});

const app = createApp(App)

app.use(router)
app.config.globalProperties.$common = common;
// app.config.globalProperties.$sockethandle = sockethandle;

app.mount('#app')
